{-# OPTIONS -Wall #-}

--------------------------------------------------------------------------------
-- |
-- Module      :  WumpusLite.GraphicProps
-- Copyright   :  (c) Stephen Tetley 2012
-- License     :  BSD3
--
-- Maintainer  :  stephen.tetley@gmail.com
-- Stability   :  unstable
-- Portability :  GHC
--
-- Data types for stroke and label styles corresponding to the
-- styles provided by PostScript / SVG (@StrokeAttr@, etc.).
--
   
--------------------------------------------------------------------------------


module WumpusLite.GraphicProps
  (
  
  -- * Stroke attributes 
    LineCap(..)
  , LineJoin(..)
  , DashPattern(..)

  -- * Fonts
  , FontFace(..)
  , SVGFontStyle(..)


  ) where

import WumpusLite.Colour


-- | Line cap - default in output is butt.
--
-- >  Cap Butt:
--
-- >  .-------.
-- >  |=======|
-- >  '-------'
--
-- >  Cap Round:
--
-- >  .-------.
-- > ( ======= )
-- >  '-------'
--
-- >  Cap Square:
--
-- >  .---------.
-- >  | ======= |
-- >  '---------'
--
data LineCap = CapButt | CapRound | CapSquare
  deriving (Enum,Eq,Show)


-- | Line join - default in output is miter.
--
-- >  Join Miter:
--
-- >      /\
-- >     /..\ 
-- >    /./\.\
-- >   /./  \.\
-- >  /./    \.\
--
-- > Join Round:
--
-- >  \.\  
-- >   \.\ 
-- >    ,.)
-- >   /./
-- >  /./
--
-- > Join Bevel:
--
-- >      __
-- >     /..\ 
-- >    /./\.\
-- >   /./  \.\
-- >  /./    \.\
--
data LineJoin = JoinMiter | JoinRound | JoinBevel
  deriving (Enum,Eq,Show)


-- | Dash pattern - either a solid line or a list of on-off pairs
-- together with an /offset/ into the dashes.
-- 
-- > Solid
--
-- > Dash offset [(on,off )..]
--
data DashPattern = Solid | Dash Int [(Int,Int)]
  deriving (Eq,Show)



--------------------------------------------------------------------------------
-- Fonts

-- TODO new to work out how we are going to manage encodings.



-- | 'FontFace' : @ postscript_name * svg_font_family * svg_font_style 
--                * encoding_vector  @
--
-- For the writing fonts in the Core 14 set the definitions are:
--
-- > "Times-Roman"       "Times New Roman" SVG_REGULAR     "AdobeStandardEncoding"
-- > "Times-Italic"      "Times New Roman" SVG_ITALIC      "AdobeStandardEncoding"
-- > "Times-Bold"        "Times New Roman" SVG_BOLD        "AdobeStandardEncoding"
-- > "Times-BoldItalic"  "Times New Roman" SVG_BOLD_ITALIC "AdobeStandardEncoding"
-- > 
-- > "Helvetica"              "Helvetica" SVG_REGULAR      "AdobeStandardEncoding"
-- > "Helvetica-Oblique"      "Helvetica" SVG_OBLIQUE      "AdobeStandardEncoding"
-- > "Helvetica-Bold"         "Helvetica" SVG_BOLD         "AdobeStandardEncoding"
-- > "Helvetica-Bold-Oblique" "Helvetica" SVG_BOLD_OBLIQUE "AdobeStandardEncoding"
-- >
-- > "Courier"              "Courier New"    SVG_REGULAR      "AdobeStandardEncoding"
-- > "Courier-Oblique"      "Courier New"    SVG_OBLIQUE      "AdobeStandardEncoding"
-- > "Courier-Bold"         "Courier New"    SVG_BOLD         "AdobeStandardEncoding"
-- > "Courier-Bold-Oblique" "Courier New"    SVG_BOLD_OBLIQUE "AdobeStandardEncoding"
--
data FontFace = FontFace
      { ps_font_name            :: String
      , svg_font_family         :: String
      , svg_font_style          :: SVGFontStyle
      , font_enc_scheme         :: String
      }
  deriving (Eq,Ord,Show)



-- | SVG font styles - potentially a style may generate both
-- @font-weight@ and @font-style@ attributes in the SVG output.
--
data SVGFontStyle = SVG_REGULAR | SVG_BOLD | SVG_ITALIC | SVG_BOLD_ITALIC
                  | SVG_OBLIQUE | SVG_BOLD_OBLIQUE
  deriving (Eq,Ord,Show)
